import {Modal} from "ant-design-vue";
import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
import {createVNode, ref} from 'vue';

export class ModalKit {
    public static confirm(content, onOk, onCancel) {
        Modal.confirm({
            title: '系统提示信息',
            icon: createVNode(ExclamationCircleOutlined),
            content: createVNode('div', {style: 'font-size:14px'}, content),
            okText: '确定',
            okType: 'primary',
            cancelText: '取消',
            okButtonProps: {
                disabled: false,
            },
            cancelButtonProps: {
                disabled: false,
            },
            onOk() {
                onOk();
            },
            onCancel() {
                onCancel();
            },
        });
    }

    public static confirmInput(onOk, onCancel) {
        const title = ref('some message');

        Modal.confirm({
            title: '系统提示信息',
            icon: createVNode(ExclamationCircleOutlined),
            content: '<input v-model:value="title" placeholder="input password" />',
            okText: '确定',
            okType: 'primary',
            cancelText: '取消',
            okButtonProps: {
                disabled: false,
            },
            cancelButtonProps: {
                disabled: false,
            },
            onOk(e) {
                onOk(e, title);
            },
            onCancel(e) {
                onCancel(e, title);
            },
        });
    }
}